package www.dianbaozu.com.ui.find.recommendationServer.adapter

import android.annotation.SuppressLint
import androidx.databinding.DataBindingUtil
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.module.LoadMoreModule
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.netease.nim.uikit.databinding.ItemSearchServerBinding
import www.dianbaozu.com.R
import www.wen.com.common.lib.data.entities.ServerEntity
import www.wen.com.common.lib.extension.glide.setImageUrl
import www.wen.com.common.lib.extension.imgUrl

class RecommendationServerAdapter :
    BaseQuickAdapter<ServerEntity, BaseViewHolder>(R.layout.item_search_server),
    LoadMoreModule {
    private var binding: ItemSearchServerBinding? = null

    @SuppressLint("SetTextI18n")
    override fun convert(holder: BaseViewHolder, item: ServerEntity) {
        binding = DataBindingUtil.bind(holder.itemView)
        binding?.apply {
            strTelegramGroup.text = item.serverName
            tvIntroduction.text = item.serverIntro
            tvOnlineCount.text = "${item.onlineCount}人在线"
            setImageUrl(ivServerLogo, item.serverBackground.imgUrl(),R.drawable.image_default_list)
            setImageUrl(ivTelegramAvatar, item.serverLogo.imgUrl())
        }
    }

}